#
#  Copyright (C) 2021 Huawei Device Co., Ltd.
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

cmake_minimum_required(VERSION 3.4.1)

project("rtmp")

#配置加载头文件
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ssl/include)

#动态方式加载
add_library(libcrypto SHARED IMPORTED )
add_library(libssl SHARED IMPORTED )

#引入第三方.so库 ${CMAKE_CURRENT_SOURCE_DIR}表示当前cmakelist所在文件夹
set_target_properties(libcrypto PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../ssl/lib/${OHOS_ARCH}/libcrypto.so)
set_target_properties(libssl PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../ssl/lib/${OHOS_ARCH}/libssl.so)

#预编译宏
##不开启openssl
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_CRYPTO")

##开启openssl
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_OPENSSL")

file(GLOB rtmp_source *.c)
file(GLOB rtmp_head *.h)

add_library(
        rtmp
        STATIC
        ${rtmp_source}
        ${rtmp_head})

target_link_libraries(rtmp
        libcrypto
        libssl
        z)
